package mws.reader;

import cn.hutool.core.io.file.PathUtil;
import mws.metadataModel.HttpMetaData;
import org.yaml.snakeyaml.Yaml;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Map;

public class YmlReader implements Reader {



  private final Yaml yaml = new Yaml();

  private final String path;

  private  String root = System.getProperty("user.dir");

  public YmlReader(String path){
      this.path = path;
  }
    @Override
    public HttpMetaData read() {

        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream(root+path);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        Map<String, Object> obj = yaml.load(inputStream);
        System.out.println(obj);


        return null;
    }

    public static void main(String[] args) {
        YmlReader ymlReader = new YmlReader("\\httpsdk-generator\\src\\main\\resources\\metaData\\model_mws.yaml");
        ymlReader.read();

    }
}
